<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\AsrPlan */
/* @var $form yii\widgets\ActiveForm */
?>
<link rel="stylesheet" href="../assets/public/bootstrap-timepicker/css/timepicker.less">
<link  rel="stylesheet" href="../assets/public/bootstrap-timepicker/timepicker/bootstrap-timepicker.css">
<link  rel="stylesheet" href="../assets/public/bootstrap-timepicker/timepicker/bootstrap-timepicker.min.css">
<script src="../assets/public/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<script src="../assets/public/bootstrap-timepicker/timepicker/bootstrap-timepicker.js"></script>
<script src="../assets/public/bootstrap-timepicker/timepicker/bootstrap-timepicker.min.js"></script>
<div class="asr-plan-form">

    <?php $form = ActiveForm::begin();
    $audio_name = \app\models\AsrAudio::find()->select('audio_id,name')->asArray()->all();
    $audio_array = \yii\helpers\ArrayHelper::map($audio_name,'audio_id','name');

    $listname = \app\models\AsrMobile::find()->select('mobile_id,listname')->asArray()->all();
    $listname_array = \yii\helpers\ArrayHelper::map($listname,'mobile_id','listname');
    $asr_call = \app\models\AsrCall::find()->select('call_id,number')->asArray()->all();
    $call_array =\yii\helpers\ArrayHelper::map($asr_call,'call_id','number');
//    foreach ($asr_call as $key=>$value){
//        $asr_calls[] = $value['number'];
//    }
//    $value = \app\models\AsrCall::find()->select('number')->where(['call_id'=>$model->call_id])->one()['number'];

    ?>

    <?= $form->field($model, 'planname')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'mobile_id')->dropDownList($listname_array, ['value'=>$model->mobile_id])->label('选择用户'); ?>

    <?=  $form->field($model, 'audio_id')->dropDownList($audio_array,['value'=>$model->audio_id])->label('选择话术');?>
    <div class="bootstrap-timepicker">
        <div class="form-group">
            <div class="input-group">
                    <?= $form->field($model, 'call_start')->textInput(['class'=>'form-control input-medium timepicker col-lg-6','id'=>'firstname']) ?>
                    <div calss="col-lg-6">
                    <?= $form->field($model, 'call_end')->textInput(['class'=>'form-control input-medium timepicker','id'=>'firstname2']) ?>
                </div>
            </div>
            <!-- /.input group -->
        </div>
        <!-- /.form group -->
    </div>
    <?=  $form->field($model, 'plan_space')->textInput(['maxlength' => true])->label('拨打间隔(秒)')?>
    <?=  $form->field($model, 'call_id')->dropDownList($call_array, ['value'=>$model->call_id])->label('主叫号码选择')?>
        <script>
            $('.timepicker').timepicker({
                showInputs: false
            });
            // $("#firstname").click(function () {
            //     alert($("#firstname").val());
            // });
        </script>
    <div class="form-group">
        <?= Html::submitButton('更新', ['class' => 'btn btn-success','id'=>'submitBtn']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
</html>
